#ifndef __COMMON__H
#define __COMMON__H

#ifdef __cplusplus
extern "C" {
#endif

#include "FreeRTOS.h"
#include "task.h"
#include "cmsis_os.h"

#include "stdbool.h"

#define         ARRAYSIZE(X)       (sizeof(X)/sizeof(X[0]))

unsigned short ModBusCRC16(unsigned char *buf, int len);

unsigned char getIndex(void);

void empty_Lqueue(osMessageQId handle);

bool checkCRC(unsigned char *data, int len);

bool abs_duration_timeout(unsigned int start,unsigned int end,unsigned int duration);

int getAverage(unsigned short buf[],int len);

#ifdef __cplusplus
 }
#endif

#endif
